package interfaces.spawnMenu.costumize.items;

import fileHandling.language.LanguageLoader;
import fileHandling.language.interfaces.SpawnMenuText;

import logic.items.Buyable;
import interfaces.GUISource;
import interfaces.superWidgets.InterfaceLabel;
import interfaces.superWidgets.KeyValueContent;

public class BuyableInfoContent<T extends Buyable> extends KeyValueContent {
	
	private InterfaceLabel amountLabel;
	
	public BuyableInfoContent(int width, int height) {
		super(width, height, GUISource.bigFont, true);
	}
	
	public void setItemType(Buyable properties, int amount) {
		clear();
		
		String left = properties.getName();
		addLine(left, "");
		
		left = LanguageLoader.get(SpawnMenuText.Purchased);
		addLabel(left, false);
		amountLabel = addLabel(amount + "", true);
		incrementY();
		
		left = properties.getDescription();
		addLine(left, "");
		
		layout();
	}
	
	public void updateAmount(int newAmount) {
		amountLabel.setText("" + newAmount);
	}
}